<template>
  <div id="read">
    <!-- 顶部导航 -->
    <div class="nav">
      <div class="nav-contain">
        <ul class="nav_ul">
          <li @click="jump('/homepage')">首页</li>
          <li @click="jump('/amazing/benzhou')">分类</li>
          <li @click="jump('/3/male')">精选</li>
          <li @click="jump('/4/all')">排行榜</li>
          <li @click="jump('/kehuduan')">客户端</li>
        </ul>
        <ul class="nav_name">
          <span class="nav_span">千锋护花队倾情打造，欢迎您的到来！</span>
          <li>制作人:陈京盛 吴智远 李航 汪澜 韩淼 翁文杰</li>
        </ul>
      </div>
    </div>

    <div class="read-contain">
      <div class="read-text">
        <h2>{{title}}</h2>
        <p>{{body}}</p>
        <p v-html="cpContent"></p>
      </div>

    </div>
  </div>
</template>

<script>
import { read } from "@/api/cjs/read";
export default {
  created() {
    let str=localStorage.getItem("link");

    read(str).then(res => {
      console.log(res);
      this.title = res.data.chapter.title;
      this.body = res.data.chapter.body;
      this.cpContent = res.data.chapter.cpContent
      this.cpContent =  this.cpContent.replace(
          /\n|\r\n/g,
          "<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
        );
    });
  },
  data() {
    return {
      title: "",
      body: "",
      cpContent:""
    };
  },
  methods: {
    jump(url){
      this.$router.push(url)
    }
  }
};
</script>

<style scoped>
p:nth-of-type(1){
  text-align: center;
}
p {
  text-indent: 2em;

  line-height: 2.5em;
  font-size: 14px;
  color: #333
}
.read-text {
  background-color: rgb(250, 238, 215);
  padding: 2em;
}
h2 {
  padding: 20px;
  text-align: center;
}
#read {
  background-color: rgb(215, 205, 182);
  min-height: 200px;
}
.nav {
  background-color: #fff;
}
.nav-contain {
  position: relative;
  width: 1200px;
  margin: 0 auto;
  background-image: url("http://rcode.zongheng.com/v2018/images/logo.png");
  background-repeat: no-repeat;
  background-size: 130px 26px;
  background-position: 50px 20px;
  overflow: hidden;
  height: 60px;

  color: #666;
}
.nav_ul {
  float: left;
  margin: 10px;
  margin-left: 200px;
}
.nav_ul > li {
  float: left;
  padding: 12px 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.nav_ul > li:hover {
  background-color: #333;
  color: #fff;
}
.nav_span {
  display: inline-block;
  margin-bottom: 15px;
  padding-left: 22px;
}
.nav_name {
  float: right;
  margin-top: 10px;
  font-size: 13px;
  margin-right: 10px;
}
.read-contain {
  width: 900px;
  margin: 0 auto;
}
.read-contain {
  margin-top: 20px;
}
</style>
